package com.hhit.bigscreenbackmanage.controller.tgygl;

import com.alibaba.fastjson.JSONObject;
import com.hhit.bigscreenbackmanage.common.Response;
import com.hhit.bigscreenbackmanage.service.tgygl.TTgyglProjectProcessService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/tgygl/projectProcess")
public class ProjectProcessController {

    private Logger log = LoggerFactory.getLogger(ProjectProcessController.class);

    @Autowired
    TTgyglProjectProcessService tTgyglProjectProcessService;

    /**
     * 获取 虞城换流站数据统计
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getYchlzCount")
    public Response getYchlzCount(@RequestBody JSONObject jsonObject){
        try{
            Map<String, Object> result = tTgyglProjectProcessService.queryYchlzCount(jsonObject);
            return Response.createResponseBySuccess("查询虞城换流站数据统计成功",result);
        }catch (Exception e){
            log.error("查询虞城换流站数据统计失败: " + e.getMessage());
            return Response.createResponseByError("查询虞城换流站数据统计失败");
        }
    }

    /**
     * 获取 直流线路工程数据统计
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getZlxlgcCount")
    public Response getZlxlgcCount(@RequestBody JSONObject jsonObject){
        jsonObject.put("project","直流线路");
        try{
            Map<String, Object> result = tTgyglProjectProcessService.queryZlxlgcOrJdjgcOrScgcCount(jsonObject);
            return Response.createResponseBySuccess("查询直流线路工程数据统计成功",result);
        }catch (Exception e){
            log.error("查询直流线路工程数据统计失败: " + e.getMessage());
            return Response.createResponseByError("查询直流线路工程数据统计失败");
        }
    }

    /**
     * 获取 接地极工程数据统计
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getJdjgcCount")
    public Response getJdjgcCount(@RequestBody JSONObject jsonObject){
        jsonObject.put("project","接地极");
        try{
            Map<String, Object> result = tTgyglProjectProcessService.queryZlxlgcOrJdjgcOrScgcCount(jsonObject);
            return Response.createResponseBySuccess("查询接地极工程数据统计成功",result);
        }catch (Exception e){
            log.error("查询接地极工程数据统计失败: " + e.getMessage());
            return Response.createResponseByError("查询接地极工程数据统计失败");
        }
    }

    /**
     * 获取 送出工程数据统计
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getScxlgcCount")
    public Response getScxlgcCount(@RequestBody JSONObject jsonObject){
        jsonObject.put("project","送出");
        try{
            Map<String, Object> result = tTgyglProjectProcessService.queryZlxlgcOrJdjgcOrScgcCount(jsonObject);
            return Response.createResponseBySuccess("查询送出工程数据统计成功",result);
        }catch (Exception e){
            log.error("查询送出工程数据统计失败: " + e.getMessage());
            return Response.createResponseByError("查询送出工程数据统计失败");
        }
    }

    /**
     * 获取 变电站改扩建工程数据统计
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getBdzgkjgcCount")
    public Response getBdzgkjgcCount(@RequestBody JSONObject jsonObject){
        try{
            Map<String, Object> result = tTgyglProjectProcessService.queryBdzgkjgcCount(jsonObject);
            return Response.createResponseBySuccess("查询变电站改扩建工程数据统计成功",result);
        }catch (Exception e){
            log.error("查询变电站改扩建工程数据统计失败: " + e.getMessage());
            return Response.createResponseByError("查询变电站改扩建工程数据统计失败");
        }
    }
}
